const exec = require('child_process');
const iconv = require('iconv-lite')
var encoding = 'GBK';
var binaryEncoding = 'binary';
window.adb = function (ext,fun) {
 
  exec.exec(ext,{ encoding: 'binary' }, (err, stdout, stderr)=>{
    if(stderr!=''){
      fun(iconv.decode(new Buffer(stderr, binaryEncoding), encoding),true)
    }else if(stdout!=''){
      fun(iconv.decode(new Buffer(stdout, binaryEncoding), encoding),false)
    }else if(err!=''){
      fun(iconv.decode(new Buffer(err, binaryEncoding), encoding),true)
    }else{
      fun("异常错误")
    }
    
  })
}
